﻿$(function () {
    $("#Search").click(function () {
        $searchValue = $("#SearchValue").val();
        var hdn = document.getElementById('hdnSearchVirtualPath');
        DoSearchbyKey($searchValue, hdn);

    });

    $("[id^=Search]").bind('keydown', function (e) {
        if (e.keyCode == 13) {
            DoSearchbyKey($(this).val());

        }
    });






});

function DoSearchbyKey($searchValue) {
    if ($searchValue == "") {
        alert("Please enter the search keywords");
        return;
    }


    var postPage = "/en/search.aspx";
    var obj = document.getElementById('hdnSearchVirtualPath');
    if (obj) postPage = obj.value + postPage;

    $(document.body).append("<form id='_form1' action='" + postPage + "' method='post'><input type='hidden' id='value' name='value'></input></form>");
    $("#value").val($searchValue);
    $("#_form1").submit();

}


//search
function doSearch(fid, pageno) {
    if (document.getElementById(fid)) {
        if (document.getElementById("pageno")) {
            document.getElementById("pageno").value = pageno;
        }

        //        if (document.getElementById(fid).q.value == "" || document.getElementById(fid).q.value == "请输入标签") {
        //            alert("请输入标签");
        //            return false;
        //        }
        document.getElementById(fid).submit();
        return true;
    }
    return false;
}
function doTagSearch(q) {
    document.getElementById("topsearchform").q.value = q;

}
//submit//